using System.ComponentModel.DataAnnotations;

namespace DaoHang.Models
{
    /// <summary>
    /// 网站全局设置模型
    /// </summary>
    public class SiteSettings
    {
        /// <summary>
        /// 设置ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 网站标题
        /// </summary>
        [MaxLength(200, ErrorMessage = "网站标题不能超过200个字符")]
        public string SiteTitle { get; set; } = "导航网站";

        /// <summary>
        /// 网站描述
        /// </summary>
        [MaxLength(500, ErrorMessage = "网站描述不能超过500个字符")]
        public string SiteDescription { get; set; } = "一个强大的导航网站系统";

        /// <summary>
        /// 网站关键词
        /// </summary>
        [MaxLength(500, ErrorMessage = "关键词不能超过500个字符")]
        public string SiteKeywords { get; set; } = "导航,网址导航,网站导航";

        /// <summary>
        /// 版权信息
        /// </summary>
        [MaxLength(500, ErrorMessage = "版权信息不能超过500个字符")]
        public string CopyrightInfo { get; set; } = "©2023 导航网站";

        /// <summary>
        /// 网站Logo URL
        /// </summary>
        [MaxLength(500, ErrorMessage = "Logo地址不能超过500个字符")]
        public string LogoUrl { get; set; } = "";

        /// <summary>
        /// 网站图标 URL
        /// </summary>
        [MaxLength(500, ErrorMessage = "图标地址不能超过500个字符")]
        public string FaviconUrl { get; set; } = "";

        /// <summary>
        /// 网站主题颜色
        /// </summary>
        [MaxLength(20, ErrorMessage = "主题颜色不能超过20个字符")]
        public string ThemeColor { get; set; } = "#3498db";

        /// <summary>
        /// 阿里云API密钥
        /// </summary>
        [MaxLength(500, ErrorMessage = "API密钥不能超过500个字符")]
        public string AliCloudApiKey { get; set; } = "";

        /// <summary>
        /// 阿里云API密钥Secret
        /// </summary>
        [MaxLength(500, ErrorMessage = "API密钥Secret不能超过500个字符")]
        public string AliCloudApiSecret { get; set; } = "";

        /// <summary>
        /// AI模型名称
        /// </summary>
        [MaxLength(100, ErrorMessage = "AI模型名称不能超过100个字符")]
        public string AiModelName { get; set; } = "qwen3-235b-a22b";

        /// <summary>
        /// ICP备案号
        /// </summary>
        public string? IcpNumber { get; set; }

        /// <summary>
        /// 公安备案号（在Admin.razor中显示为版权信息）
        /// </summary>
        public string? PoliceNumber { get; set; }

        /// <summary>
        /// 阿里云百炼API密钥
        /// </summary>
        [MaxLength(500, ErrorMessage = "API密钥不能超过500个字符")]
        public string? ApiKey { get; set; }

        /// <summary>
        /// 管理后台路由
        /// </summary>
        [MaxLength(50, ErrorMessage = "管理路由不能超过50个字符")]
        public string AdminRoute { get; set; } = "admin";

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; } = DateTime.Now;

        // 为了兼容Admin.razor中的绑定，添加这些属性作为IcpNumber和PoliceNumber的别名
        
        /// <summary>
        /// ICP信息（IcpNumber的别名，用于Admin.razor绑定）
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        public string? IcpInfo 
        { 
            get => IcpNumber; 
            set => IcpNumber = value; 
        }

        /// <summary>
        /// 版权信息（PoliceNumber的别名，用于Admin.razor绑定）
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        public string? Copyright 
        { 
            get => PoliceNumber; 
            set => PoliceNumber = value; 
        }

        // 以下属性不存储到数据库，仅用于修改密码表单绑定
        
        /// <summary>
        /// 当前密码（仅用于表单，不存储到数据库）
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        [System.ComponentModel.DataAnnotations.Schema.NotMapped]
        public string? CurrentPassword { get; set; }

        /// <summary>
        /// 新密码（仅用于表单，不存储到数据库）
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        [System.ComponentModel.DataAnnotations.Schema.NotMapped]
        public string? NewPassword { get; set; }

        /// <summary>
        /// 确认新密码（仅用于表单，不存储到数据库）
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        [System.ComponentModel.DataAnnotations.Schema.NotMapped]
        public string? ConfirmPassword { get; set; }
    }
} 